<template>
  <a-config-provider :locale="locale">
    <div id="app">
      <router-view/>
    </div>
  </a-config-provider>
</template>

<script>
import { domTitle, setDocumentTitle } from '@/utils/domUtil'
import { i18nRender } from '@/locales'

export default {
  data () {
    return {

    }
  },
  computed: {
    locale () {
      // 只是为了切换语言时，更新标题
      const { title } = this.$route.meta
      title && (setDocumentTitle(`${i18nRender(title)} - ${domTitle}`))

      return this.$i18n.getLocaleMessage(this.$store.getters.lang).antLocale
    }
  },
  mounted () {
    window.onresize = () => {
      if (document.body.clientWidth < 1000) {
        this.$store.dispatch('setModelWidth', '60%')
        if (document.body.clientWidth < 800) {
          this.$store.dispatch('setModelWidth', '500px')
        }
        if (document.body.clientWidth < 500) {
          this.$store.dispatch('setModelWidth', '100%')
        }
      } else {
        this.$store.dispatch('setModelWidth', '600px')
      }
    }
  }
}
</script>
<style>
#app{
  height: 100%;
  min-width: 1366px;
  overflow: auto!important;
}
@font-face {
  font-family: myfont;
  src: url('https://sf6-ttcdn-tos.pstatp.com/obj/feelgood/ClarityMono-SemiBold.otf') format('opentype');
}

.my-font {
  font-family: myfont;
}
</style>
